A5Storage::DataItem SetFromFile Method
Syntax
.SetFromFile as L (SourcePath as C, ContentType as C [, Offset as N [, Length as N]])
Arguments
- SourcePathCharacter
The file that contents are copied from.
- ContentTypeCharacter
The content type.
- OffsetNumeric
Default = 0. Offset into the file where copying should begin. A value of 0 will start copying at the beginning of the file.
- LengthNumeric
Default = -1. The amount of data to copy. If -1, all data is copied starting at the offset.
Returns
- ResultLogical
Returns .T. if the operation succeeds, otherwise .F. (see .CallResult for additional error information.)
Description
Set the object value from the file specified in SourcePath and sets the content based on ContentType.
Example
dim CallResult as CallResult dim Container as A5Storage::DataContainer = null_value() CallResult = A5Storage::DataContainer::Open(Container, "Provider='Disk';Container='c:\A5Webroot';") if CallResult.Success dim Item A5Storage::DataItem = null_value() if Container.ReferenceItem(Item, "MyObjectName") if .not. Item.SetFromFile(File.To_Blob("MyFile.jpg", "image/jpg") showvar(Item.CallResult.Text, "Error in SetFromFile") end if end if end if